/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package mp.weixin.WXpublic;


/**
 *
 * @author 王仲秋
 */
public abstract class BaseEvent extends BaseReceiveMessage {

    public abstract EventEnum getEvent();

    @Override
    public ReceiveTypeEnum getMsgType() {
        return ReceiveTypeEnum.EVENT;
    }

    public enum EventEnum {

        SUBSCRIBE("订阅", "subscribe"),
        UNSUBSCRIBE("取消订阅", "unsubscribe"),
        /**
         * 如果用户还未关注公众号，则用户可以关注公众号，关注后微信会将带场景值关注事件推送给开发者。
         * 如果用户已经关注公众号，则微信会将带场景值扫描事件推送给开发者。
         */
        SCAN("扫码", "SCAN"),
        LOCATION("上报位置", "LOCATION"),
        CLICK("点击菜单", "CLICK"),
        VIEW("点击菜单跳转", "VIEW"),
        /**
         * 不论用户是否接受公众号的模板消息
         * 在模版消息发送任务完成后，微信服务器会将是否送达成功作为通知，发送到开发者中心中填写的服务器配置地址中。 
         * 都会触发这个事件
         */
        TEMPLATESENDJOBFINISH("模板消息送达","TEMPLATESENDJOBFINISH"),
        FK_CREATE_SESSION("客服会话创建","kf_create_session"),
        KF_CLOSE_SESSION("客服会话关闭","kf_close_session"),
        KF_SWITCH_SESSION("客服会话转接","kf_switch_session");
        private final String desc;
        private final String type;

        public String getDesc() {
            return desc;
        }

        public String getType() {
            return type;
        }

        private EventEnum(String desc, String type) {
            this.desc = desc;
            this.type = type;
        }

        public static EventEnum getEventByType(String type) {
            return valueOf(type.toUpperCase());
        }
    }
}
